package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by sss on 2016/10/11.
 */
@Entity
@Table(name = "l2r_group_position_base")
@DynamicInsert
public class L2RGroupPositionBase extends BaseEntity{
    public enum L2RPositionBase_{
        cityCode,positionType,parentCode,positionCode,name
    }

    /**
     * 城市代码
     */
    private Long cityCode;
    /**
     * 位置类型
     */
    private String positionType;
    /**
     * 位置代码
     */
    private String positionCode;
    /**
     * 名称
     */
    private String name;
    /**
     * 检索代码
     */
    private String searchCode;

    @Basic
    @Column(name = "city_code", nullable = true)
    public Long getCityCode() {
        return cityCode;
    }

    public void setCityCode(Long cityCode) {
        this.cityCode = cityCode;
    }

    @Basic
    @Column(name = "position_type", nullable = false, length = 128)
    public String getPositionType() {
        return positionType;
    }

    public void setPositionType(String positionType) {
        this.positionType = positionType;
    }

    @Basic
    @Column(name = "position_code", nullable = false, length = 128)
    public String getPositionCode() {
        return positionCode;
    }

    public void setPositionCode(String positionCode) {
        this.positionCode = positionCode;
    }

    @Basic
    @Column(name = "name", nullable = true, length = 64)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "search_code", nullable = true, length = 128)
    public String getSearchCode() {
        return searchCode;
    }

    public void setSearchCode(String searchCode) {
        this.searchCode = searchCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RGroupPositionBase that = (L2RGroupPositionBase) o;

        if (cityCode != null ? !cityCode.equals(that.cityCode) : that.cityCode != null) return false;
        if (positionType != null ? !positionType.equals(that.positionType) : that.positionType != null) return false;
        if (positionCode != null ? !positionCode.equals(that.positionCode) : that.positionCode != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        return true;
    }

    @Override
    public int hashCode() {
        int result = cityCode != null ? cityCode.hashCode() : 0;
        result = 31 * result + (positionType != null ? positionType.hashCode() : 0);
        result = 31 * result + (positionCode != null ? positionCode.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }
}
